Under an execution environment, such as a Java execution environment, where an interpreter and a dynamic compiler operate in conjunction with each other, an execution object of a program can transition from a code column executed by means of the interpreter to a compiled code column during an execution of a method, a unit of compilation. For example, a method involved in a loop process is compiled during the loop process and an execution object of a program transitions (loop-transitions) to an execution of a compiled code column. In this case, an operation for adjusting an image of local variables is required at a transition part between a part executed by means of an interpreter and a part executed in a compiled code column (a jump-in entry from an interpreter).
For just-in-time (JIT) compiler corresponding to IA-64, which is an architecture of 64 bit CPU from U.S. Intel Corporation, needs an implementation concept of a “variable type” to adjust an image of local variables of a code column executed by means of an interpreter and a compiled code column. For this reason, one has to generate and insert a copy instruction explicitly having a type within a basic block of a jump-in entry from an interpreter (referred to as Xfer BB hereinafter), i.e., a copy instruction with “definitions of a variable”.
FIG. 7 is a diagram for showing an arrangement of code columns at a jump-in entry from an interpreter. In the example shown in FIG. 7, explicit instructions for adjusting images of local variables of a code column executed by means of an interpreter and a compiled code column, “L2=IMEMLOAD”, “L2=extend L2”, “L3=IMEMLOAD”, “L3=extend L3”, “L4=AMEMLOAD” and “L5=AMEMLOAD” are inserted into Xfer BB in a code column executed by means of an interpreter.
However, the explicit “definitions of a variable”, which is inserted into a jump-in entry from an interpreter to adjust images of local variables of a code column executed by means of an interpreter and a compiled code column obstructed most optimization including program transformation (optimization) by means of a forward dataflow analysis or a UD (Use-Definition)-chain.
As a determination way of a variable type, the way of determining the type of a Live variable (in computer science, the live variable analysis is a classic data flow analysis performed by compliers to calculate for each program point the variables that may be potentially read afterwards before their next write update, that is, the variables that are live at the exit from each program point) by means of a backward data flow analysis at the end of Xfer BB is adopted. With this determination, however, the “type of a variable” for all local variables on a code column executed by means of an interpreter cannot be obtained. This further complicates the problem.
In the example shown in FIG. 7, the result of copy instructions “L2=L1”, “L3=1”, and “L4=L5” (L refers to a local variable, i.e., “L2=L1” means copying of a value of local variable L1 to local variable L2) at a basic block of a compiled code column before a junction of a code column executed by means of an interpreter and a compiled code column (simply referred to as “a junction” hereinafter) can be propagated to “ . . . =L2”, “ . . . =L4”, “CMP-eq L3, 0”, etc. in the following basic block during optimization of a program. However, as instructions for adjusting images of the local variables L2, L3, L4, and L5 are written in Xfer BB of a code column executed by means of an interpreter, each of the above-mentioned copy instructions cannot be propagated in a forward dataflow analysis and the like.
One reason why optimization as a forward dataflow analysis cannot get across a junction, is that it is recognized that a value of a local variable is not yet decided in the optimization due to explicitly written instructions for adjusting images of the local variables in Xfer BB of a code column executed by means of an interpreter. For example, although a value of 1 is copied in local variable L3 in a compiled code column, the value in local variable L3 cannot be decided to be 1, because instructions “L3=IMEMLOAD” and “L3=extend L3” exist in Xfer BB.
A code column executed by means of an interpreter and a compiled code column are originally the same program. Thus, values of each local variable for a code column executed by means of an interpreter and for a compiled code column should also be the same at a junction. Therefore, an effect of optimization was unnecessarily arrested when an explicit instruction for adjusting images of a local variable, which is inserted into Xfer BB of a code column executed by means of an interpreter, stops optimization by means of a forward dataflow analysis or a UD-chain.
Although IA-64 has been described as an example here, it is also true for architectures of various CPUs other than 32-bit.